/**
 * Copyright (c) 2012 Axa Holding Belgium, SA. All rights reserved.
 * This software is the confidential and proprietary information of the AXA Group.
 */
package chabernac.android.wordraster.rastersolver;

import java.io.IOException;
import java.net.URL;
import java.util.Iterator;
import java.util.zip.ZipInputStream;

import chabernac.android.wordraster.utils.ZipFileIterator;

public class URLWordLoader implements iWordLoader {
  private final String myBaseURL;
  
  public URLWordLoader( String aBaseURL ) {
    super();
    myBaseURL = aBaseURL;
  }

  @Override
  public Iterator<String> getWordsForLanguage( String aLanguage ) throws IOException{
    URL theURL = new URL(myBaseURL + "/" + aLanguage + ".zip");
    ZipInputStream theZipInputStream = new ZipInputStream( theURL.openStream() );
    
    return new ZipFileIterator(theZipInputStream, "dic");
  }
}
